package com.dq.controller.serviceproject;

import com.dq.exception.customException.AdminException;
import com.dq.vo.Vo;
import com.dq.domain.service.ServiceProject;
import com.dq.service.AllService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author cf
 */
@Api(description = "服务项目/类别 关联")
@RestController
@RequestMapping("sys/boss/serviceCategoryCentre/")
public class ServiceProjectCategoryCentreController extends AllService {

    @ApiOperation("添加 服务项目/类别 关联")
    @PostMapping("/relation/{projectId}")
    @RequiresPermissions("sys:serviceCategoryCentre:relation")
    public Vo relation(@RequestBody() List<Long> categoryIds, @PathVariable @ApiParam(value = "服务项目id") Long projectId) throws AdminException {
        ServiceProject serviceProject = dao.get(ServiceProject.class, projectId);

        return serviceProjectCategoryCentrService.relation(categoryIds, serviceProject);
    }

}
